<template>
  <div class="uploadContain shou" @click="uploadimg">
    <input
      class="uploadContain_input"
      type="file"
      ref="fileInput"
      @change="uploadFile($event)"
      accept="image/*"
      multiple
    />
    <img class="uploadContain_addIcon" src="@/assets/images/add.png" alt="加载失败" />
    <div class="uploadContain_tip">上传图片</div>
  </div>
</template>

<script>
export default {
  props: {
  },
  data() {
    return {};
  },
  mounted() {},
  methods: {
    uploadimg() {
      this.$refs.fileInput.click();
    },
    uploadFile(event) {
      this.$emit('upload',event.target)
    },
  },
};
</script>
<style scoped lang="scss">
.uploadContain {
  width: 102px;
  height: 102px;
  border-radius: 4px;
  border: 1px dashed #b8c4d1;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 24px;
  &_addIcon {
    width: 20px;
    height: 20px;
  }
  &_tip {
    margin-top: 23px;
    line-height: 1;
    text-align: center;
    font-size: 14px;
    font-weight: 400;
    color: #999;
  }
  &_input {
    display: none;
  }
}
</style>
